#ifndef RS232_H_
#define RS232_H_

#include <htc.h>
#include "delay.h"



#define	DLY		3		/* cycles per null loop ERA 3 !! */
#define	TX_OHEAD	13		/* overhead cycles per loop */
#define	RX_OHEAD	12		/* receiver overhead per loop */

#define	DELAY(ohead)	(((XTAL/4/BRATE)-(ohead))/DLY)

/*	Transmit and Receive port bits*/
static bit	TxData @ (unsigned)&PORTB*8+5;
static bit	RxData @ (unsigned)&PORTB*8+5;
#define	INIT_TX	TRISB4 = 1
#define	INIT_RX	TRISB6 = 1

/*	Xtal frequency */
#define	XTAL          3686400

/*	Baud rate	*/
#define	BRATE  1200

void putch(char c);
void putstr(register const char *str);
char getch(void);
char getche(void);


#endif /*RS232_H_*/
